<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /*
      基本数据类型
        string number boolean null undefined symbol
      引用数据类型
        object array function 

      ES6扩展了一种新的基本数据类型 symbol

      特点：symbol值是唯一的
      作用：用来作为对象唯一属性名
    */

      const s1 = Symbol("name");
      console.log(s1, typeof s1);

      const s2 = Symbol("age");
      console.log(s1, s2);
      console.log(s1 === s2); // false

      /*
        对象的属性名类型：string 和 symbol 
          其他类型会转string类型
      */
      const person = {};
      person.name = "jack";
      const obj = { a: 1 };
      const arr = [1, 2, 3];
      person[obj] = 111;
      person[arr] = 222;
      person[s1] = 333;
      person[s2] = 444;
      console.log(person);
    </script>
  </body>
</html>
